package bairui.international.console.web.controller.custom.custom;

import com.lianjing.sh.spring.web.controller.enhance.module.Module;
import com.lianjing.sh.spring.web.controller.enhance.module.ModuleHead;
import com.lianjing.sh.spring.web.controller.enhance.output.bean.DataDisplay;
import com.lianjing.sh.spring.web.controller.enhance.output.bean.DataType;
import com.lianjing.sh.spring.web.controller.enhance.output.bean.OutputBean;
import com.lianjing.sh.spring.web.controller.enhance.output.bean.OutputType;

/**
 *
 * Module_Edit
 *
 */
class Module_Edit{

	
	public Module module(
		bairui.international.model.domain.jpa.TB_Custom bean
		, Module_Edit_Head_OutputModel beanHead
		, 
		C_CustomCustom_Edit_Edit.Edit.Operate c_CustomCustom_Edit_Edit_Edit_Operate
		,C_CustomCustom_Publish_Submit.Submit.Operate c_CustomCustom_Publish_Submit_Submit_Operate
		,C_CustomCustom_Up_Submit.Submit.Operate c_CustomCustom_Up_Submit_Submit_Operate
		,C_CustomCustom_Down_Submit.Submit.Operate c_CustomCustom_Down_Submit_Submit_Operate
				
		,com.lianjing.sh.spring.web.controller.enhance.input.InputModelContextMethodInfoEditor ... editors
		
	){
		return moduleTemplate(
				bean
		, 		beanHead
				, 
				c_CustomCustom_Edit_Edit_Edit_Operate
		,		c_CustomCustom_Publish_Submit_Submit_Operate
		,		c_CustomCustom_Up_Submit_Submit_Operate
		,		c_CustomCustom_Down_Submit_Submit_Operate
						
				,editors
			);
	}
	
	public Module module(
		java.util.List<bairui.international.model.domain.jpa.TB_Custom> bean
		, Module_Edit_Head_OutputModel beanHead
		, 
		C_CustomCustom_Edit_Edit.Edit.Operate c_CustomCustom_Edit_Edit_Edit_Operate
		,C_CustomCustom_Publish_Submit.Submit.Operate c_CustomCustom_Publish_Submit_Submit_Operate
		,C_CustomCustom_Up_Submit.Submit.Operate c_CustomCustom_Up_Submit_Submit_Operate
		,C_CustomCustom_Down_Submit.Submit.Operate c_CustomCustom_Down_Submit_Submit_Operate
				
		,com.lianjing.sh.spring.web.controller.enhance.input.InputModelContextMethodInfoEditor ... editors
		
	){
		return moduleTemplate(
				bean
		, 		beanHead
				, 
				c_CustomCustom_Edit_Edit_Edit_Operate
		,		c_CustomCustom_Publish_Submit_Submit_Operate
		,		c_CustomCustom_Up_Submit_Submit_Operate
		,		c_CustomCustom_Down_Submit_Submit_Operate
						
				,editors
			);
	}
	
	
	/**
	 * 编辑模块
	 */
	private Module moduleTemplate(
		Object bean
		, Module_Edit_Head_OutputModel beanHead
		, 
		C_CustomCustom_Edit_Edit.Edit.Operate c_CustomCustom_Edit_Edit_Edit_Operate
		,C_CustomCustom_Publish_Submit.Submit.Operate c_CustomCustom_Publish_Submit_Submit_Operate
		,C_CustomCustom_Up_Submit.Submit.Operate c_CustomCustom_Up_Submit_Submit_Operate
		,C_CustomCustom_Down_Submit.Submit.Operate c_CustomCustom_Down_Submit_Submit_Operate
				
		,com.lianjing.sh.spring.web.controller.enhance.input.InputModelContextMethodInfoEditor ... editors
		
	){
		return
			new Module(
					new ModuleHead(beanHead, Module_Head_OutputData.info())
						.addOperate(
							c_CustomCustom_Publish_Submit_Submit_Operate
								.defaultComment("发布")
						)
						.addOperate(
							c_CustomCustom_Up_Submit_Submit_Operate
								.defaultComment("上架")
						)
						.addOperate(
							c_CustomCustom_Down_Submit_Submit_Operate
								.defaultComment("下架")
						)
					, 
					new com.lianjing.sh.spring.web.controller.enhance.module.body.EditModuleBody(
							bean, 
							Model.class,
							c_CustomCustom_Edit_Edit_Edit_Operate, 
							Relation.relations(
								)
							,editors
						)
				);
	}
	
	/**
	 * 输入模型
	 */
	static public class Models {
		private @lombok.Getter @lombok.Setter java.util.List<Model> models = new java.util.ArrayList<>();
	}
	
	@org.springframework.stereotype.Component("bairui.international.console.web.controller.custom.custom.Module_Edit$Model")
	
	static public class Model
	
	 extends bairui.international.model.domain.jpa.TB_Custom
	
	 implements 
	
		com.lianjing.sh.spring.web.controller.enhance.input.InputModelable
	
	{
	
	
	
		/**
	
		 * 默认构造函数
	
		 */
	
		public Model(){}
	
	
	
		/**
	
		 * 构造函数
	
		 */
	
		public Model(
	
			bairui.international.model.domain.jpa.TB_Custom bean
	
		){
	
			if(null != bean){
	
				this.setContent(bean.getContent());
	
			}
	
		}
	
		
	
	
	
		@com.lianjing.sh.model.common.annotation.Comment("内容")
	
		@com.sh_lianjing.reflect.method.annotation.MethodOrder(1001)
	
		@org.hibernate.validator.constraints.NotBlank
	
		@javax.validation.constraints.Size(min=0, max=20000)
	
		@com.lianjing.sh.validate.generic.Editor
	
		@Override
	
		public String getContent() {
	
			return (String)super.getContent();
	
		}
	
		
	
	
	
		/**
	
		 * 非继承属性
	
		 */
	
	
	
		/**
	
		 * 得到输入属性
	
		 */
	
		/** 得到内容 */
	
		public String gainContent() {
	
			return this.getContent();
	
		}
	
	
	
		/**
	
		 * 转换到表单数据格式
	
		 */
	
		public java.util.Map<String, String> toFormData() throws com.sh_lianjing.serialize.json.jackson.exception.JsonException{
	
			return com.lianjing.sh.web.common.util.Util_Form.beanToFormDataFormat(this);
	
		}
	
	
	
	}
	
	
	
	static public class Relation
	{
		public static java.util.Map<String, java.util.List<?>> relations(
		){
			java.util.Map<String, java.util.List<?>> map = new java.util.HashMap<>();
			return map;
		}
	}
	
	
	
	/**
	 * 输出模型
	 */
		private static class Module_Head_OutputData {
		
			private static final OutputBean[] info() {
				Module_Head_OutputData outputData = new Module_Head_OutputData();
				return new OutputBean[]{
							outputData.getState(),
					};
			}
		
			OutputBean getState(){
				return new OutputBean("state", "状态", true, DataDisplay.Show, DataType.Enum, new OutputType[]{OutputType.Ajax, OutputType.Excel, }, "yy/MM/dd HH:mm:ss");
			}
		}
		
		
	
	

}
